package Porperties;

import java.util.Comparator;

public class WuGui {
    int age;

    public WuGui() {
    }

    public WuGui(int age) {
        this.age = age;
    }

    //重写toString方法
    public String toString() {
        return "小乌龟{" +
                "age=" + age +
                '}';
    }
}//编写比较器，实现接口，Comparator
class WuGuiComparator implements Comparator<WuGui>{
    //重写方法比较
    public int compare(WuGui o1, WuGui o2) {
        return o1.age- o2.age;
    }
}
